External Link Creation

Hi All,

 

in this below code i try to create external links

 

string create(Object j, string description, string name, ExternalLinkDirection extLinkDir, ExternalLinkBehaviour extLinkBeh, string body, ExternalLink& extLink)

void mainFunction(string sConcPath,string sELemAbs,string sExLinkName,string sExLinkType,string sExLinkNotes) 
{  
    Module sourceMod
    string sm = sConcPath    
    sourceMod = edit sm
    
    ExternalLink el1 = null
    ExternalLinkBehaviour sExLType
    ExternalLinkDirection extLinkDir = outward
    
    int iO = intOf(sELemAbs)    
    Object o = gotoObject(iO, sourceMod)    
    
    if(sExLinkType == "Local File" )
    {
        sExLType = "none"
    }
    else
    {
        sExLType = "openAsURL"
    }

    create(o, sExLinkNotes, sExLinkName, extLinkDir, sExLType, sExLinkName, el1) 

}

 

what am i missing here?


maknabil - Tue Dec 01 06:06:52 EST 2015

Re: External Link Creation
Mathias Mamsch - Tue Dec 01 17:30:14 EST 2015

Maybe to call the mainFunction? :-) To check for the result of create? Normally DOORS will tell you what is wrong and not silently just do nothing. Regards, Mathias

Re: External Link Creation
DoorsXLAustralia - Mon Dec 07 04:04:07 EST 2015

 

Take the quotes away from the assigned values (none, openAsURL) . They are not string variables:-

 

 if(sExLinkType == "Local File" )
    {
        sExLType = none
    }
    else
    {
        sExLType = openAsURL
    }

 

Sean

Re: External Link Creation
maknabil - Mon Dec 07 04:32:44 EST 2015

DoorsXLAustralia - Mon Dec 07 04:04:07 EST 2015

 

Take the quotes away from the assigned values (none, openAsURL) . They are not string variables:-

 

 if(sExLinkType == "Local File" )
    {
        sExLType = none
    }
    else
    {
        sExLType = openAsURL
    }

 

Sean

Thanks this worked 

but Now I'm not getting any errors 

But the external link is not created.

I removed the below function from code do we need to call this?

string create(Object j, string description, string name, ExternalLinkDirection extLinkDir, ExternalLinkBehaviour extLinkBeh, string body, ExternalLink& extLink)

 

another doubt I have declared ExternalLink el1 = null any issue with this?

Re: External Link Creation
DoorsXLAustralia - Mon Dec 07 05:33:00 EST 2015

Yes, you need the 'create' line.

That is the line that creates the link.

You can just declare el1 without setting it null.

Setting it null will not cause any problems though.

Sean

Re: External Link Creation
maknabil - Mon Dec 07 05:35:00 EST 2015

DoorsXLAustralia - Mon Dec 07 05:33:00 EST 2015

Yes, you need the 'create' line.

That is the line that creates the link.

You can just declare el1 without setting it null.

Setting it null will not cause any problems though.

Sean

Thanks Sean,

Passing empty string description failed to create a link.

Now the code works perfect.

void mainFunction(string sConcPath,string sELemAbs,string sExLinkName,string sExLinkType,string sExLinkNotes) 
{  
        ExternalLink eXLnk
        
        ExternalLinkBehaviour sExLType
        ExternalLinkDirection extLinkDir = outward
        
        int iO = intOf(sELemAbs)        
        Object o = gotoObject(iO, sourceMod)    
        
        if(sExLinkType == "Local File" )
        {
                sExLType = none
        }
        else
        {
                sExLType = openAsURL
        }
        
        if(sExLinkNotes == "")
        {
                sExLinkNotes = "Empty"
        }
        
        ack (NLS_(""))o.(NLS_("Object Heading"))(NLS_(""))
        print create(o, sExLinkNotes, sExLinkName, extLinkDir, sExLType, sExLinkName, eXLnk)

}